package com.vancouver.knows.ui.fragment.homePage;

import com.vancouver.knows.business.BusinessModule;
import com.vancouver.knows.MainApplication;
import com.pangu.task.mark.ATaskMark;
import com.pangu.ui.refresh.ARefreshViewController;
import com.pangu.ui.refresh.RefreshControllerView;

import android.app.Activity;
import android.content.Context;
import android.view.View;

/**
 * 首页内容下拉界面
 * 
 * @author llf
 * 
 */
public class HomepagePullRefreshView extends RefreshControllerView {
	
	public HomepagePullRefreshView(Context context) {
		super(context);
	}

	@SuppressWarnings("rawtypes")
	@Override
	public void onRefresh(ARefreshViewController controller) {
		((HomepageAddHeadView) content).handleRefreshLoadItem();
	}

	public void loadData(HomepageAddHeadView.HomepageListener listener, Activity activity) {
		BusinessModule module = ((MainApplication) imContext).getBusinessModule();
		ATaskMark aTaskMark = module.getTaskMarkPool().getHomePageTaskMarkList();
		((HomepageAddHeadView) content).sendActivityAndListener(activity, listener);
		((HomepageAddHeadView) content).initLoadableView(aTaskMark);
	}

	@Override
	protected View createContentView() {
		return new HomepageAddHeadView(getContext(), this);
	}
	
	public void updateHomePage(){
		((HomepageAddHeadView) content).updateHomePage();
	}
}
